# Contributor: Nick Black <dankamongmen@gmail.com>
# Maintainer: Nick Black <dankamongmen@gmail.com>
pkgname=notcurses
pkgver=1.6.11
pkgrel=0
pkgdesc="Blingful character graphics and TUI library"
url="https://nick-black.com/dankwiki/index.php/Notcurses"
arch="all"
license="Apache-2.0"
depends="ncurses-terminfo"
makedepends="cmake ncurses-dev linux-headers ffmpeg-dev doctest-dev libunistring-dev"
subpackages="$pkgname-static $pkgname-dbg $pkgname-dev $pkgname-doc"
options="!check" # Need /dev/tty which we don't have on builders
source="$pkgname-$pkgver.tar.gz::https://github.com/dankamongmen/notcurses/archive/v$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DUSE_PANDOC=off \
		-DUSE_QRCODEGEN=off \
		-DUSE_PYTHON=off \
		$CMAKE_CROSSOPTS
	make -C build
}

check() {
	make -C build test
}

package() {
	make -C build DESTDIR="$pkgdir" install
}

sha512sums="44d389d2cb054e20480ad124bb4b2b596a25b46b0ac3136f9b2ccca97ea5e4782ea10fc5b87206ef61adc7b8b10207a00f5c6b938340ddc17c502e308d0d9773  notcurses-1.6.11.tar.gz"
